package cn.ekuma.epos.datalogic.define.dao.crm.concerns;

import e.odbo.data.dao.BaseDAO;
import cn.ekuma.epos.db.table.crm.concerns.I_CustomerConcerns;
import com.openbravo.bean.crm.concerns.CustomerConcerns;
import com.openbravo.data.basic.BasicException;
import com.openbravo.data.loader.serialize.DataRead;
import com.openbravo.data.loader.serialize.DataWrite;
import com.openbravo.data.loader.serialize.Datas;
import com.openbravo.data.loader.I_Session;
import com.openbravo.data.loader.table.TableDefinition;
import com.openbravo.data.model.Field;
import com.openbravo.format.Formats;

public class CustomerConcernsDAO extends BaseDAO<CustomerConcerns> {

	public CustomerConcernsDAO(I_Session s) {
		super(s);
	}

	@Override
	public TableDefinition getTable() {
		return new TableDefinition(
                "CONCERNS_CUSTOMER",
                new Field[]{
                    new Field(I_CustomerConcerns.ID, Datas.STRING, Formats.STRING),
                    new Field(I_CustomerConcerns.CONCERNSID, Datas.STRING, Formats.STRING),
                    new Field(I_CustomerConcerns.CUSTOMERID, Datas.STRING, Formats.STRING)  
                },
                new int[]{0});
	}

	@Override
	public void writeInsertValues(DataWrite dp, CustomerConcerns obj)
			throws BasicException {
		dp.setString(1,obj.getKey());
		dp.setString(2, obj.getConcernsId());
		dp.setString(3,obj.getCustomerId());
		
	}

	@Override
	public Class getSuportClass() {
		return CustomerConcerns.class;
	}

	@Override
	public CustomerConcerns readValues(DataRead dr, CustomerConcerns obj)
			throws BasicException {
		if(obj==null)
			obj=new CustomerConcerns();
		obj.setKey(dr.getString(1));
		obj.setConcernsId(dr.getString(2));
		obj.setCustomerId(dr.getString(3));
		return obj;
	}

}
